< previous page page_430 next page >

Page 430
8160-0430a.gif
Figure 21.7
A list of employees that can be clicked on for editing.
Examples Filename: Emps.frm
8160-0430b.gif
Figure 21.8
The Employee Information form.
Inside the Edit button on the Employee List form, you would expect the code to look something like this:
9f31265bb40b592b1929e18a47ab28e5.gif
Sub cmdEdit_Click ()
   ' Display the Employee Form
   frmEmployee.Show
End Sub
If you click the first employee and execute this code, the form displays with that employees information in it. However, if you come back to the list box, click another employee, and execute this code again, you simply redisplay the same screen with the old employee information. This is because Visual Basic determines that this form is already loaded and displayed, and it will simply give this form focus. The Form_Load() event does not occur again, and thats where the text boxes for the form are initialized with the appropriate data:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub Form_Load()

   Call FormShow

End Sub

 
< previous page page_430 next page >

If you like this book, buy it!